<!DOCTYPE html>
<html lang='zh-CN'>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <title>候鸟订单表</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/materialdesignicons.min.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.min.css" rel="stylesheet">
    <link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
</head>
<body>
<div class="container-fluid p-t-15">

    <div class="row">
        <div class="col-md-12">
            <div class="card">
                <div class="card-header"><h4>候鸟订单记录</h4></div>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade active in">

                        <form class="form-inline" method="post" id="searchForm">
                            <div class="form-group">
                                <label>收件人:</label>
                                <input type="text" class="form-control" name="userName">
                            </div>
                            <div class="form-group">
                                <label>支付时间:</label>
                                <input type="text" class="form-control js-datepicker" data-date-format="yyyy-mm-dd" name="startTime" placeholder="开始时间" style="width:120px;"> -
                                <input type="text" class="form-control js-datepicker" data-date-format="yyyy-mm-dd" name="endTime" placeholder="结束时间" style="width:120px;">
                            </div>
                            <div class="form-group">
                                <label>烽鸟易购订单状态:</label>
                                <select name="orderState" class="form-control">
                                    <option value="">全部</option>
                                    <option value="-3">异常订单</option>
                                    <option value="-2">待付款</option>
                                    <option value="-1">已取消</option>
                                    <option value="0">待发货</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-info btn_query btn-round"  type="button" id="searchFormBtn" >查询</button>
                            </div>
                            <div class="form-group">
                                <button class="btn btn-purple btn_query btn-round" type="button" id="watchBtn">商品详情</button>
                            </div>
                        </form>
                        <table id="list_data"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!--  上传凭证模态框 -->
    <div class="modal fade" id="pictureModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabels">
        <div class="modal-dialog" role="document" style="width: 60%;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="ProductInformation">商品详细显示</h4>
                </div>
                <div class="modal-body" id="pictures"></div>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
<script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
<script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>
<script type="text/javascript" src="js/dropzone/min/dropzone.min.js"></script>
<script type="text/javascript" src="js/bootstrapvalidator/dist/js/bootstrapValidator.js"></script>
<!-- bootstrap表单验证插件 -->
<script type="text/javascript" src="js/bootstrap-validator-master/dist/validator.js"></script>
<!-- jquery-form表单提交插件 -->
<script type="text/javascript" src="js/jquery-form/jquery.form.js"></script>
<!-- bootstrap弹出框插件 -->
<script type="text/javascript" src="js/jquery.bootstrap.min.js"></script>
<!-- 表单填充插件 -->
<script type="text/javascript" src="js/jquery-form/jquery.formloader.js"></script>
<!--日期选择插件-->
<script src="js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>

<script type="text/javascript">

    //设置表头
    var columns = [
        {checkbox: true},
        {field: 'orderNo',title: '候鸟单号'},
        {field: 'goodName',title: '商品名称'},
        {field: 'goodPic',title: '商品图片',formatter: function (value, row, index) {
                if (value==null||value==''){
                    return '无图片'
                }else {
                    return "<img style='width: 80px' src='"+value+"'/>";
                }
            }},
        {field: 'hnGoodItems',title: '商品信息',visible: false},
        {field: 'createTime',title: '创建时间',formatter:function (value) {
                return zero2one.dateFormat(value, 'Y-m-d H:i:s')
            }},
        {field: 'orderState',title: '烽鸟易购订单状态',formatter:function (value) {
                if (value ==-3 ){
                    return  "<button class=\"btn btn-danger btn-sm\">异常订单</button>";
                }else if(value == -2){
                    return  "<button class=\"btn btn-secondary btn-sm\">待付款</button>";
                }else if(value == -1 ){
                    return  "<button class=\"btn btn-primary btn-sm\">已取消</button>";
                }else if(value == 0 ){
                    return  "<button class=\"btn btn-warning btn-sm\">待发货</button>";
                }else {
                    return "无"
                }
            }},
        {field: 'hnOrderStatus',title: '候鸟订单状态',visible: false},
        {field: 'realTotalMoney',title: '金额'},
        {field: 'payType',title: '支付渠道',formatter:function (value) {
               if (value =='pearl' ){
                  return "珍珠"
               }else if(value == 'alipay'){
                   return "支付宝"
                }else if(value =='wxpay' ){
                   return "微信"
               }else {
                   return "无"
               }
            }},
        {field: 'userName',title: '收件人'},
        {field: 'approveTime',title: '审核时间',formatter:function (value) {
            if (value==null || value==''){
                return "无"
            }else {
                return zero2one.dateFormat(value, 'Y-m-d H:i:s')
            }
            }},
        {field: 'payTime',title: '支付时间', formatter: function (value) {
                if (value==null || value==''){
                    return "无"
                }else {
                    return zero2one.dateFormat(value, 'Y-m-d H:i:s')
                }
            }},
        {field: 'memberId',title: '会员账号'},
        {field: 'isDelete',title: '是否已删除' ,visible: false},
        {field: 'goodsNum',title: '商品数量'},
        {field: 'cusOrderNo',title: '第三方平台单号'}
    ];


    //进入主界面加载数据
    zero2one.datagrid("list_data", "/remote/migratoryBirdOrder/list",function (params) {
        return $.extend(zero2one.tableInitParam(params), zero2one.form2json("searchForm"));
    }, columns);

    //点击查询按钮重新加载页面数据
    $("#searchFormBtn").click(function () {
        $('#list_data').bootstrapTable('refresh');
    });


    //点击商品详情
    $("#watchBtn").click(function () {
        //获取选中行的数据
        var datas = $('#list_data').bootstrapTable('getSelections');

        //判断是否选中行数据，如果没有则提示
        if(datas.length == 1){
            var content='';
                content+=
                    '<label style="font-size: x-large">商品名称：</label><label style="font-size: large">'+datas[0].goodName+'</label></br>'
                    +'<label style="font-size: x-large">商品数量：</label><label style="font-size: large">'+datas[0].goodsNum+'</label></br>';
                    if (datas[0].goodPic != null || datas[0].goodPic != ''){
                        content+='<label style="font-size: larger">图片:</label></br>'+"<img style='width: auto;height: auto;border-radius: 10%'  src='"+datas[0].goodPic+"'/>"
                    }else {
                        content+='<label style="font-size: larger">图片:</label></br>'+"无";
                    }
                    +'<hr>';

            $("#pictures").html(content);
            //打开模态框
            $("#pictureModal").modal("show");

        }else{
            $.messager.alert("温馨提示", "请选择一条数据操作");
        }
    });

</script>
</body>
</html>
